home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-11 | 3.6 KB | 135 lines | [TEXT/CWIE] |
- // Release Version: $ ODF 3 $
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- //========================================================================================
- #include "Data.hpp"
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef PIZZA_H
- #include "Pizza.h" // CPizza
- #endif
-
- //--- OpenDoc ------------------------------------------------------------------
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh> // kODPropContents
- #endif
-
- //========================================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment Data
- #endif
-
- //========================================================================================
- // Template instantiation
- #include "FWTColl.tpp"
-
- FW_DEFINE_AUTO_TEMPLATE(FW_TOrderedCollection, CPizzaCollection)
- FW_DEFINE_AUTO_TEMPLATE(FW_TOrderedCollectionIterator, CPizzaCollectionIterator)
-
- #ifdef FW_USE_TEMPLATE_PRAGMAS
- #pragma template_access public
- #pragma template FW_TOrderedCollection<CPizzaCollection>
- #pragma template FW_TOrderedCollectionIterator<CPizzaCollectionIterator>
- #else
- template class FW_TOrderedCollection<CPizzaCollection>;
- template class FW_TOrderedCollectionIterator<CPizzaCollectionIterator>;
- #endif
-
- FW_DEFINE_AUTO(CDataContent)
-
- //----------------------------------------------------------------------------------------
- CDataContent::CDataContent(Environment* ev, CDataPart* part)
- : FW_CContent(ev, part),
- fEmbeddedString("Embedded string"),
- fStringPtr(NULL),
- fBufferPtr(NULL),
- fBufferBytes(0),
- fPart(part),
- fNumPizzas(0),
- fPizzaList(NULL)
- {
- fStringPtr = FW_NEW(FW_CString, ("String Pointer") );
-
- // init buffer
- fBufferBytes = 1000;
- fBufferPtr = FW_CMemoryManager::AllocateBlock(fBufferBytes);
-
- fPizzaList = FW_NEW(CPizzaCollection, ());
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- CDataContent::~CDataContent()
- {
- FW_START_DESTRUCTOR
- delete fStringPtr;
- FW_CMemoryManager::FreeBlock(fBufferPtr);
- CPizza* pizza = NULL;
- while ((pizza = fPizzaList->First()) != NULL) {
- fPizzaList->Remove(pizza);
- delete pizza;
- }
- delete fPizzaList;
- }
-
- //----------------------------------------------------------------------------------------
- CPizzaCollection*
- CDataContent::MyGetPizzaList()
- {
- return fPizzaList;
- }
-
- //----------------------------------------------------------------------------------------
- void
- CDataContent::MyIncrement(Environment* ev, FW_CPoint& position)
- {
- fNumPizzas++;
-
- FW_CPoint halfSize( FW_IntToFixed(15), FW_IntToFixed(15) );
- FW_CRect bounds(position - halfSize, position + halfSize);
-
- CPizza* pizza = new CPizza(bounds);
- fPizzaList->AddLast(pizza);
- fPart->MyPartChanged(ev, bounds);
- }
-
- //----------------------------------------------------------------------------------------
- void
- CDataContent::ExternalizeKind(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_CKind* kind,
- FW_StorageKinds storageKind,
- FW_CPromise* promise,
- FW_CCloneInfo* cloneInfo)
- {
- FW_UNUSED(ev);
- FW_UNUSED(storageUnit);
- FW_UNUSED(kind);
- FW_UNUSED(storageKind);
- FW_UNUSED(promise);
- FW_UNUSED(cloneInfo);
- }
-
- //----------------------------------------------------------------------------------------
- FW_Boolean
- CDataContent::InternalizeKind(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_CKind* kind,
- FW_StorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- FW_UNUSED(ev);
- FW_UNUSED(storageUnit);
- FW_UNUSED(kind);
- FW_UNUSED(storageKind);
- FW_UNUSED(cloneInfo);
- return FALSE;
- }
-